package com.alks.function.controller.biocontrol.deptwork;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcFinishOemOutDetail;
import com.alks.entity.data.entity.PcOmeLotHead;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.biocontrol.deptwork.ProdDetailRequest;
import com.alks.function.data.request.biocontrol.deptwork.ProdTempRequest;
import com.alks.function.service.biocontrol.deptwork.IProdCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author MS
 * @since 2024/8/3上午10:10
 */
@RestController
@ApiRestController("/bioDeptWrok/ProdCollect")
@Api(value = "生控作业", tags = "生控部-生控作业-生产采集")
@Slf4j
public class ProdCollectController {
    @Autowired
    private IProdCollectService service;

    private final String collectType = "O";

    @WebLogger
    @PostMapping("/tempQuery")
    @ApiOperation(value = "主页主表查询-分页可条件查询", tags = "生控部-生控作业-生产采集")
    public ResponseInfo tempQuery(@RequestBody ProdTempRequest request) {
        return service.tempQuery(request);
    }

    @WebLogger
    @PostMapping("/stats")
    @ApiOperation(value = "主页统计-可条件查询", tags = "生控部-生控作业-生产采集")
    public ResponseInfo stats(@RequestBody ProdTempRequest request) {
        return service.stats(request);
    }

    @WebLogger
    @PostMapping("/tempBack")
    @ApiOperation(value = "主页侧栏回显-可条件查询", tags = "生控部-生控作业-生产采集")
    public ResponseInfo tempBack(@RequestBody ProdTempRequest request) {
        return service.tempBack(request);
    }

    @WebLogger
    @PostMapping("/detailQuery")
    @ApiOperation(value = "明细-分页可条件查询", tags = "生控部-生控作业-生产采集")
    public ResponseInfo detailQuery(@RequestBody@Valid ProdDetailRequest request) {
        return service.detailQuery(request);
    }

    @WebLogger
    @PutMapping("/detailDelete")
    @ApiOperation(value = "明细删除-删除", tags = "生控部-生控作业-生产采集")
    public ResponseInfo detailDelete(@RequestBody PcFinishOemOutDetail request) {
        return service.detailDelete(request);
    }

    @WebLogger
    @PostMapping("/outAdd")
    @ApiOperation(value = "出货-新增", tags = "生控部-生控作业-生产采集")
    public ResponseInfo outAdd(@RequestBody@Valid PcFinishOemOutDetail request) {
        return service.outAdd(request,collectType);
    }

    @WebLogger
    @PostMapping("/update")
    @ApiOperation(value = "修改工厂指令-更新", tags = "生控部-生控作业-生产采集")
    public ResponseInfo update(@RequestBody PcOmeLotHead request) {
        return service.update(request);
    }


}